import 'package:flutter/material.dart';

void main() {
  runApp(
    Shell(),
  );
}

class Shell extends StatefulWidget {
  @override
  _ShellState createState() => _ShellState();
}

class _ShellState extends State<Shell> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(),
    );
  }
}

class TabANavigator extends StatefulWidget {
  @override
  _TabANavigatorState createState() => _TabANavigatorState();
}

class _TabANavigatorState extends State<TabANavigator> {
  @override
  Widget build(BuildContext context) {
    ModalRoute.of(context).settings.name;
    return Navigator(
      initialRoute: '/route-a/route-b/route-c/route-d',
      onGenerateRoute: TabARouteFactory.onGenerateRoute,
      onPopPage: (route, result) {
        return route.didPop(result);
      },
    );
  }
}

class TabARouteFactory {
  static Route<dynamic> onGenerateRoute(RouteSettings routeSettings) {
    switch (routeSettings.name) {
      case '/':
      case 'route-a':
      case 'route-b':
      case 'route-c':
      case 'route-d':
      default:
        return MaterialPageRoute(
          builder: (context) => CommonPage(
            title: routeSettings.name,
          ),
        );
    }
  }
}

class CommonPage extends StatefulWidget {
  final String title;
  CommonPage({this.title});
  @override
  _CommonPageState createState() => _CommonPageState();
}

class _CommonPageState extends State<CommonPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('title'),
      ),
      body: Container(
        child: Text('${widget.title}'),
      ),
    );
  }
}
